import json

import requests

from shargeApi.config import *


class LoginAPI():

    def __init__(self):
        pass

    #获取sessionid
    def login_sessionid(self):
        url = url_login_password
        json_data = {"area":"86","mobile":"15361441154","password":"147952la"}
        jsonData= json.dumps(json_data)
        headers = {"Content-Type":"application/json"}
        res = requests.post(url = url,data = jsonData.encode('utf-8'),  headers=headers)
        # print(res.headers)
        result = json.loads(res.text)
        print(result["data"]["sessionId"])
        return result["data"]["sessionId"]

LoginAPI().login_sessionid()